package com.enlorenz.core.engine.manager;

import com.enlorenz.core.base.IObjectSeqInitializing;
import com.enlorenz.core.engine.IEngine;
import com.enlorenz.core.engine.exception.EngineControlException;

/**
 * 引擎管理者，用于集中管理引擎的启动，停止，和重启等功能
 * @author lcb
 */
public class ForceEngineManager extends EngineManager implements IObjectSeqInitializing{
	@Override
	public void objectSeqInit() throws Exception{
		startEngines();
	}
	
	public void startEngine(IEngine engine) throws EngineControlException{
		logger.info("----启动线程[{}]开始",engine.getName());
		long st=System.currentTimeMillis();
		try{
			engine.init();
			engine.start();
		}catch (Exception e) {
			e.printStackTrace();
		}
		long ed=System.currentTimeMillis();
		logger.info("----启动线程[{}]结束,用时[{}]毫秒",engine.getName(),String.valueOf(ed-st));
	}
	
}
